<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
      
    <ui:composition template="/new-template/template-crud.xhtml">
    	
    	<ui:define name="tituloPagina">
    		<h:outputText value="Cadastro NCM :: ZPE" />
    	</ui:define>
    	
    	<ui:define name="parametros">
    	   <ui:param name="bean" value="#{nomeclaturaBean}" />
    	</ui:define>
    	
    	<ui:define name="tituloFieldSetFiltro">
		   <h:outputText value="&nbsp; Pesquisa de NCM &nbsp;" />
		</ui:define>
		
		<ui:define name="camposFiltro">
			<h:panelGrid columns="2" columnClasses="colunaBusca">
				  		
				 <h:outputLabel value="Descrição: "/>
				 <h:inputText id="inputText" value="#{bean.entitySearch.descricao}" 
							  size="50" maxlength="50"	>
					<f:converter converterId="converterStringVazia"/>
					<f:validator validatorId="textoValidator"/>
				 </h:inputText>	
				 
			</h:panelGrid>
		</ui:define>
		
		<ui:define name="tituloPainel">
		  <ui:param name="tituloPainel" value="NCM" />
		</ui:define>
		
		<ui:define name="resultFiltro">
			<p:dataTable align="center" 
   						 width="600px" 
   						 id="transacoes"
   						 rows="10"
   						 pageLinks="3"
   						 paginatorAlwaysVisible="false"
   						 emptyMessage="Nenhuma NCM foi encontrada."
   						 value="#{bean.resultSearch}" 
       					 var="ncm" 
       					 paginator="#{bean.resultSearch.rowCount > 0}"
       					 paginatorPosition="bottom"
       					 rowStyleClass="bgLinha1,bgLinha2">
       					
       						<p:column headerText="" style="width:60px; text-align:center;">
       							<div class="colunaAcao">					    			
									<h:commandButton style="border:none;" 
													 id="cmdUpd" 
													 image="#{resource['img:ico_edit.gif']}"
													 actionListener="#{bean.prepareUpdate}">
										  <p:ajax update=":painelGlobal" />
									</h:commandButton>
								</div>
       						</p:column>
       						
       						<p:column headerText="ID" style="text-align:center;">
       							<h:outputText value="#{ncm.id}" />
       						</p:column>
       						
       						<p:column headerText="Nome" style="text-align:left;" >
       							<h:outputText value="#{ncm.descricao}" />
       						</p:column>
       						
       						<p:column headerText="Sigla" style="text-align:left;" >
       							<h:outputText value="#{ncm.sigla}" />
       						</p:column>

       						<p:column style="width:60px; text-align:center;">
       							<f:facet name="header">
       								<h:selectBooleanCheckbox styleClass="ui-checkBoxMain" rendered="#{bean.resultSearch.rowCount > 0}" />
       							</f:facet>
       							<h:selectBooleanCheckbox styleClass="ui-checkBox" valueChangeListener="#{bean.select}" />
       						</p:column>
       						
				 	</p:dataTable> 
		</ui:define>
		
		<ui:define name="tituloFieldSetInsert">
		  <h:outputLabel value="&nbsp; Cadastro de Transações" />
		</ui:define>
		
		<ui:define name="camposInsert">
			<h:panelGrid columns="2" columnClasses="colunaBusca" >
				  		
			  <h:outputLabel value="Nome: *"/>
			  <h:inputText required="true" 
						   label="Nome"
						   value="#{bean.entity.descricao}" 
						   maxlength="50" 
						   size="40">						
			  </h:inputText>	
			  
			  <h:outputLabel value="Sigla *"/>
			  <h:inputText required="true" 
						   label="Sigla"
						   value="#{bean.entity.sigla}" 
						   maxlength="50" 
						   size="40">						
			  </h:inputText>	

		  </h:panelGrid>
		</ui:define>
		
    </ui:composition>
</html>